<!DOCTYPE html>
<html>

    <head  th:include="head :: fragment_head">
        <title>集采活动-正在集采</title>
    </head>
	<body class="grayBody">
		<div class="youarehere">
			<span class="opcityText"><a href="javascript:;">首页</a></span>
			<span class="trueImg"><img th:src="@{/images/blueDian.png}" src="images/blueDian.png"></span>
			<span class="trueText"><a href="javascript:;">集采活动</a></span>
		</div>
		<div class="orderTopCheck">
			<a href="javascript:;" class="active">正在集采</a>
			<a href="javascript:;">往期集采</a>
		</div>
		<!--未完成-->
		<div class="myorderBox" >
			<div class="myorderList">
				<ul>
					<li class="timeLi" th:each="co:${listCollect}">
						<div class="myActivity-floor1">
							<p class="mjca-place">集采城市：<span th:text="*{co.city}">杭州市</span></p>
							<p class="mjca-time">集采时间：<span th:text="*{co.start_time}" > 2018.12.31 12:59</span>—<span th:text="*{co.end_time}" >2019.01.23 12:59</span></p>
							<p class="mjca-date">
								<span class="jc-time"  th:datetime1="*{co.start_time}" th:datetime2="*{co.end_time}" datetime="1234568"  th:flag="*{co.number}"  flag="1"  >距结束：
									<i class="day_show flag1"  th:class="'day_show flag'+*{co.number}" >0天</i>
									<i class="hour_show flag1" th:class="'hour_show flag'+*{co.number}">0时</i>
									<i class="minute_show flag1" th:class="'minute_show flag'+*{co.number}">0分</i>
									<i class="second_show flag1" th:class="'second_show flag'+*{co.number}">0秒</i>
								</span>
							</p>
						</div>
						<div class="myorder-floor2">
							<div class="mf2-brand">
								<div class="mf2-brand-left" th:text="*{co.brand}">东明石化</div>
								<div class="mf2-brand-right"  th:each="pro:${co.listProduct}">
									<p><span th:text="${pro.product_name}">92#汽油（国IV）</span></p>
								</div>
							</div>
							<div class="mf2-more">
								<a th:href="'/verify/getCollectGoing?collect_number='+*{co.number}" href="/verify/getCollectGoing?number=">参加</a>
							</div>
						</div>
					</li>

				</ul>
			</div>
		</div>



		<!--已完成-->
		<div class="myorderBox" style="display: none;">
			<div class="myorderList">
				<ul>
					<li th:each="cd:${listCollected}">
						<div class="myjicai-floor1">
							<p class="mjc-time"><span th:text="*{cd.start_time}" > 2018.12.31 12:59</span>—<span th:text="*{cd.end_time}" >2019.01.23 12:59</span></p>
							<p class="mjc-img"><img th:src="@{/images/over.png}" src="images/over.png"/></p>
						</div>
						<div class="myorder-floor2">
							<div class="mf2-brand">
								<div class="mf2-brand-left" th:text="*{cd.brand}">东明石化</div>
                                <div class="mf2-brand-right"  th:each="pro:${cd.listProduct}">
                                    <p><span th:text="${pro.product_name}">92#汽油（国IV）</span></p>
                                </div>
							</div>
							<div class="mf2-total">
								<p class="mf2-total-left mjca-total">总集采量：<span th:text="*{cd.amount}">500吨</span></p>
								<p class="mf2-total-right mjca-more">
									<a href="/collect/getCollectDetail">详情</a>
								</p>
							</div>
						</div>
					</li>

				</ul>
			</div>
		</div>
		<div class="footerheight"></div>

        <div class="footer" th:include="footer :: fragment_footer"></div>

        <script type="text/javascript" th:src="@{/js/footer.js}" src="js/footer.js" ></script>

		<script>
			$(document).ready(function(){
				$(".footerheight").height($(".footer").height());
			})
			$(function(){
				$(".orderTopCheck a").click(function(){
					$(".orderTopCheck a").removeClass("active");
					$(this).addClass("active");
					var par = $(this).parents(".grayBody");
					par.find(".myorderBox").hide(); 
					var arr = par.find(".orderTopCheck a");
				    var brr = par.find(".myorderBox:eq("+$.inArray(this,arr)+")");
				    brr.show();
				})
			})
		</script>
		<script type="text/javascript">	
			$(".timeLi").each(function(){
				var datetime1 = $(this).find(".jc-time").attr("datetime1");
                var timestamp1 = Date.parse(new Date());
                timestamp1 = timestamp1 / 1000;

                var datetime2 = $(this).find(".jc-time").attr("datetime2");
                var timestamp2 = Date.parse(new Date(datetime2));
                timestamp2 = timestamp2 / 1000;

                var datetime=timestamp2-timestamp1;
				console.log(datetime);
				var flag = $(this).find(".jc-time").attr("flag");

				timer(datetime,flag);
			})
			function timer(intDiff,flag){
			    window.setInterval(function(){
			    var day=0,
			        hour=0,
			        minute=0,
			        second=0;//时间默认值        
			    if(intDiff > 0){
			        day = Math.floor(intDiff / (60 * 60 * 24));
			        hour = Math.floor(intDiff / (60 * 60)) - (day * 24);
			        minute = Math.floor(intDiff / 60) - (day * 24 * 60) - (hour * 60);
			        second = Math.floor(intDiff) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
			    }
			    if (minute <= 9) minute = '0' + minute;
			    if (second <= 9) second = '0' + second;
			    $('.day_show.flag'+flag).html(day+"天");
			    $('.hour_show.flag'+flag).html('<s id="h"></s>'+hour+'时');
			    $('.minute_show.flag'+flag).html('<s></s>'+minute+'分');
			    $('.second_show.flag'+flag).html('<s></s>'+second+'秒');
			    intDiff--;
			    }, 1000);
			} 
		</script>
	</body>
</html>
